#ifndef MYLOGIN_H
#define MYLOGIN_H

#include <QDialog>

QT_BEGIN_NAMESPACE
namespace Ui { class MyLogin; }
QT_END_NAMESPACE

class MyLogin : public QDialog
{
    Q_OBJECT

public:
    MyLogin(QWidget *parent = nullptr);
    ~MyLogin();


    void styleSelf();//自身的样式修改
    void styleAccountAndPasword();//修改账号密码框样式
    void styleLoginButton();//修改登录按钮样式
    void styleCloseButton();//关闭按钮
    void styleOnlineButton();//上线/隐身按钮
    void styleUnderButton();

    void mousePressEvent(QMouseEvent *event);//单击鼠标，可以判断左右键
    void mouseMoveEvent(QMouseEvent *event);//鼠标移动
    void mouseReleaseEvent(QMouseEvent *event);//鼠标点击后的释放

    void paintEvent(QPaintEvent *event);//画横线

    //登陆回调
    void apiLoginCallback(int code, QString msg);

private slots:
    void on_loginButton_clicked();

    void on_closeButton_clicked();

    void on_statusButton_clicked();

    void on_account_textChanged(const QString &arg1);

    void on_password_textChanged(const QString &arg1);

private:
    Ui::MyLogin *ui;

    //账号
    QString account;

    //密码
    QString password;

    //uid
    int uid = 0;

    //当前login界面是否有被鼠标选中后移动
    bool m_moving = false;

    //当前login界面移动的距离
    QPoint m_lastPos;

    //当前login界面(在线/隐身)按钮状态
    bool status_online = true;


/***************style sheet*****************/
private:
    //按钮初始化样式
    const QString LOGIN_BUTTON_INIT = "QPushButton{border-image:url(:/icon/source/login/icon-enter-undo.png)}";

    //输入账号和密码后的样式
    const QString LOGIN_BUTTON_INPUT = "QPushButton{border-image:url(:/icon/source/login/icon-enter-normal.png)}"
                                       "QPushButton:hover{border-image:url(:/icon/source/login/icon-enter-hover.png)}"
                                       "QPushButton:pressed{border-image:url(:/icon/source/login/icon-enter-down.png)}";

    //under按钮
    const QString UNDER_BUTTON_NORMAL = "QPushButton{border-image:url(:/icon/source/login/icon-bigarrow-normal.png)}"
                                        "QPushButton:hover{border-image:url(:/icon/source/login/icon-bigarrow-hover.png)}"
                                        "QPushButton:pressed{border-image:url(:/icon/source/login/icon-bigarrow-down.png)}";

};
#endif // MYLOGIN_H
